package com.hlbspringcloud.usercenter.controller.user;

import com.hlbspringcloud.usercenter.domain.entity.user.User;
import com.hlbspringcloud.usercenter.service.user.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: user控制器
 * @PROJECT_NAME: spring-cloud-alibaba
 * @CLASS_NAME:
 * @Author: huanglibin
 * @Date: 2020-05-24 2:33
 * @Version: 1.0
 */
@RestController
@RequestMapping("/users")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController {

    private final UserService userService;

    /**
     * 根据id，查询指定用户的信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public User findById(@PathVariable Integer id){
        System.out.println("我被请求了....");
        return this.userService.findById(id);
    }

    @GetMapping("/get-test")
    public User getUser(User user){
        return user;
    }
}
